import re
def getsql(sql):
    # str = '''
    # b'{"retCode":200,"retMessage":"Success","retData":{"stmtProgresses":[{"statement":"desc ods_cz_ykgz_fasc_rpt_co_year_emp_tpl","state":"INITIALIZED","exception":null,"createTime":1587964273000,"startTime":null,"endTime":null}],
    # "trackingUrl":"https://10.45.45.44:30905/gateway/emr/yarn/proxy/application_1587473557426_0002","status":"PROCESSING","instanceId":"SPARKSQL-aa6245a7-1520-4f78-8f7c-21ede638d7b6:b0662396-f7ea-4b09-abfd-dfe77049ce07-action-SPARKSQL:temp-version"}}'
    # '''
    match_obj = re.findall(r"\"statement\":(.+?),\"startTime\"",sql)[0]
    return match_obj
#获取记录数与总数相等的dict
# def get_all_dict(dict,total):
#     for key in list(dict.keys()):
#         if(dict[key]!=total):
#             del dict[key]
#     return dict
def get_all_dict(dict,total):
    for key in dict:
        if(key != total):
            dict.remove(key)
    return dict
# def get_small_dict(dict,total):
#     for key in list(dict.keys()):
#         if (dict[key] == total):
#             del dict[key]
#     return dict
def get_small_dict(dict,total):
    for key in dict:
        if(key == total):
            dict.remove(key)
    return dict

def fuk_nmb(a):
    for key in list(a.keys()):
        if(a[key]==1):
            del a[key]
    return a
def trim_num_full(full):
    for key in list(full.keys()):
        full[key[:-4]]= full.pop(key)
    return full
def del_total(full):
    for key in list(full.keys()):
        if (key == 'total'):
            del full[key]
    print('1')
    return full
def trim_num_small(small):
    for key in list(small.keys()):
        small[key[:-4]] = small.pop(key)
    return small
if __name__ == '__main__':
    a = {'a': 1, 'b': 0, 'c': 1, 'd': 0}
    b = fuk_nmb(a)
    print('s')

